package active.state.lottery;

import java.util.Random;

public class DispenseState implements LotteryState {

    LotteryActivity lotteryActivity;

    public DispenseState(LotteryActivity lotteryActivity) {
        this.lotteryActivity = lotteryActivity;
    }

    @Override
    public void deductMoney() {
        System.out.println("不能扣除积分");
    }

    @Override
    public boolean lotteryDraw() {
        System.out.println("不能抽奖");
        return false;
    }

    @Override
    public void dispensePrize() {
        if (lotteryActivity.getCount() > 0) {
            System.out.println("恭喜您中奖了");
            // 不可抽奖
            lotteryActivity.setLotteryState(lotteryActivity.getNoLotteryState());
        } else {
            System.out.println("很遗憾, 奖品发完了");
            // 奖品发放完成
            lotteryActivity.setLotteryState(lotteryActivity.getDispenseOutState());
        }
    }
}
